import 'dart:io';

import 'package:FineArt/components/rounded_button.dart';
import 'package:FineArt/constants.dart';
import 'package:FineArt/core/api/user_api.dart';
import 'package:FineArt/core/utils/toast.dart';
import 'package:FineArt/page/splash/role_choose.dart';
import 'package:FineArt/utils/log_util.dart';
import 'package:FineArt/utils/size_config.dart';
import 'package:FineArt/utils/sputils.dart';
import 'package:badges/badges.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bugly/flutter_bugly.dart';
import 'package:image_picker/image_picker.dart';
import 'package:package_info/package_info.dart';
import 'package:url_launcher/url_launcher.dart';

class ContactServicePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return new _ContactServicePageState();
  }
}

class _ContactServicePageState extends State<ContactServicePage> {
  String versionName = "";
  String userName;
  Size _size;

  UserInfo userInfo;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
      setState(() {
        versionName = packageInfo.version + "." + packageInfo.buildNumber;
      });
    });
  }

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
  }

  @override
  Widget build(BuildContext context) {
    _size = MediaQuery.of(context).size;
    // SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]);
    // TODO: implement build
    return Scaffold(
        appBar: AppBar(
        toolbarHeight: 0,
        brightness: Brightness.light,
          elevation: 0,
          backgroundColor: Colors.white,),
        backgroundColor: bg_button_gray,
        body: _buildContainer());
  }

  Widget buildTitle(){
    return Container(height: getPortraitSHeight(55),width: SizeConfig.screenWidth,
    color: Colors.white,
    child: Row(children: [
      SizedBox(width: getPortraitSWidth(12),),
      InkWell(child:  Image.asset("assets/images/icon_back_black.png",width: getPortraitSWidth(11),height: getPortraitSHeight(18),),
        onTap: (){
          Navigator.of(context).pop();
        },),

      SizedBox(width: getPortraitSWidth(135),),
      Text(
        "联系客服",
        style: TextStyle(fontSize: 18, color: text_black),
      ),
    ],),);
  }
  Widget _buildContainer() {
    return Container(
      color: Color(0xfff2f2f2),
      width: _size.width,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: _buildListChild(),
        ),

    );
  }

  List<Widget> _buildListChild() {
    return [
      //头像
      // buildHeader(),
      buildTitle(),
      SizedBox(
        height: getPortraitSHeight(7),
      ),
      InkWell(child:
      Container(width: SizeConfig.screenWidth-60,
      alignment: Alignment.center,
      margin: EdgeInsets.symmetric(horizontal: 40),
      padding: EdgeInsets.symmetric(vertical: 40),
      child:Text("欢迎拨打美术云客户服务热线 \n 400-000-000",style: TextStyle(color: text_black,fontSize: setSp(15),height: 1.5),),
      color: Colors.white,),onTap: (){
        launch("tel://400-000-000");
      },)
    ];
  }





}
